<!--
 * @Author: your name
 * @Date: 2021-05-16 17:40:34
 * @LastEditTime: 2021-05-16 21:34:33
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \undefinedd:\练习\纯CSS轮播图.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>北极光之夜。</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body{
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: rgb(164, 202, 224);
        }
        .main{
            position: relative;
            width: 400px;
            height: 250px;
            overflow: hidden;
            border-radius: 5px;
        }
        .item{
            position: absolute;
            top: 0;
            width: 100%;
            height: 100%;
            transition: all 0.5s;
            background-size: cover;
        }
        .item1{
           background-image: url(./img/1.jpg);
        }
        .item2{
            background-image: url(./img/4.jpg);
            left: 100%;
        }
        .item3{
            background-image: url(./img/11.jpg);
            left: 200%;
        }
        input{
            position: relative;
            z-index: 100;
            /* display: none; */
        }
        .select{
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            width: 60px;
            height: 10px;
            z-index: 1;
            display: flex;
            justify-content: space-between;
            align-items: center;         
        }
        .select>label{
            width: 10px;
            height: 10px;
            background-color: rgb(255, 255, 255);
            border-radius: 50%;
            cursor: pointer;
            border: 1.5px solid white;
        }
        .main input:nth-of-type(1):checked ~ .select label:nth-of-type(1){
            background-color: rgb(26, 26, 26);
        }
        .main input:nth-of-type(2):checked ~ .select label:nth-of-type(2){
            background-color: rgb(26, 26, 26);
        }
        .main input:nth-of-type(3):checked ~ .select label:nth-of-type(3){
            background-color: rgb(26, 26, 26);
        }
        .main input:nth-of-type(1):checked ~ .item{
            transform: translateX(0);
        }
        .main input:nth-of-type(2):checked ~ .item{
            transform: translateX(-100%);
        }
        .main input:nth-of-type(3):checked ~ .item{
            transform: translateX(-200%);
        }
    </style>
</head>
<body>
   <!--  底层盒子 -->
    <div class="main">
        <!-- 三个单选按钮，先默认选择第一个 -->
        <input type="radio" name="choose" id="choose1" checked>
        <input type="radio" name="choose" id="choose2">
        <input type="radio" name="choose" id="choose3">      
        <!-- 放三张图片，用背景图片表示 -->
        <div class="item item1"></div>
        <div class="item item2"></div>
        <div class="item item3"></div>
        <!-- 三个label标签 -->
         <span class="select">
             <label for="choose1"></label>
             <label for="choose2"></label>
             <label for="choose3"></label>
         </span>
    </div>
</body>
</html>